package com.kai.awt.component;

import javax.swing.*;
import java.awt.*;

/**
 * @Author Mr.Yan
 * @create 2022/3/20 14:33
 * @description:
 */
public class Demo1 {

    public static void main(String[] args) {
        Frame frame = new Frame("demo1");

        TextArea textArea = new TextArea(5, 20);

        Choice choice = new Choice();
        choice.add("红ss色");
        choice.add("红qq色");
        choice.add("红色");

        CheckboxGroup checkboxGroup = new CheckboxGroup();
        Checkbox male = new Checkbox("男", checkboxGroup, true);
        Checkbox female = new Checkbox("女", checkboxGroup, false);

        Checkbox isAdult = new Checkbox("是否成年?");

        TextField textField = new TextField(20);
        JButton button = new JButton("确认");

        List list = new List(6,true);
        list.add("绿色");
        list.add("绿色");
        list.add("绿色");

        Box hBox1 = Box.createHorizontalBox();
        hBox1.add(textField);
        hBox1.add(button);
        frame.add(hBox1,BorderLayout.SOUTH);

        Box hBox2 = Box.createHorizontalBox();
        hBox2.add(choice);
        hBox2.add(male);
        hBox2.add(female);
        hBox2.add(isAdult);


        Box vBox1 = Box.createVerticalBox();
        vBox1.add(textArea);
        vBox1.add(hBox2);

        Box hBox3 = Box.createHorizontalBox();
        hBox3.add(vBox1);
        hBox3.add(list);
        frame.add(hBox3);

        frame.pack();
        frame.setVisible(true);



    }
}
